package com.kiku.consumer.web;


import com.kiku.consumer.client.UserClient;
import com.kiku.consumer.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Kiku
 * @date 2019/6/12 16:54
 */

@RequestMapping("consumer")
@RestController
@Slf4j
public class ConsumerController {

    @Autowired
    private UserClient userClient;

    @GetMapping("{id}")
    public User queryById(@PathVariable("id") Integer id){

       return userClient.queryById(id);
    }

    public String queryByIdFallback(Integer id){
        return "服务器正忙,请稍后访问";
    }

    public String defaultFallback(){
        return "服务器正忙,请稍后访问";
    }

}
